package bridge;

import java.math.BigDecimal;


/**
 * @author bajo
 *
 */
public class Team2ndRound extends Team {

	int result1stRound;
	/**
	 * @param number
	 * @param name
	 */
	public Team2ndRound(String number, String name) {
		super(number, name);
	}

	
    public int getSumOfResults() {
    	return result1stRound + super.getSumOfResults();
    }
		
	/**
	 * @return
	 */
	public int getResult1stRound() {
		return result1stRound;
	}

	/**
	 * @param i
	 */
	public void setResult1stRound(int i) {
		result1stRound = i;
	}

    public BigDecimal getSrednia() {
    	double suma = getSumOfResults();
    	int ileWynikow = 11;
    	BigDecimal wynik = new BigDecimal ("0.00");
    	for (int result = 0; result < results.length; result++) {
    		if (results[result] >= 0) ileWynikow++;
    	}
    	BigDecimal ileWynikowBD = new BigDecimal( ileWynikow);
    	//double sumaD = suma
    	if (ileWynikow > 0)
    		wynik = new BigDecimal( suma).setScale(2, 2).divide(ileWynikowBD, BigDecimal.ROUND_HALF_UP) ;
    			
    	return wynik;
    }
	
}
